Imports BusinessLayer
Imports EntityLayer
Imports System.Data

Partial Class VistaSolicitudCompra
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            ListarSolicitante()
            Dim intNumCompra As Integer
            intNumCompra = CInt(Request.QueryString("strCodigo"))

            Dim dt As DataTable
            dt = SolicitudCompraBL.ListarxCodigo(intNumCompra).Tables(0)

            txtNumero.Text = dt.Rows(0)(0).ToString
            txtFecha.Text = dt.Rows(0)(1).ToString
            ddlSolicitante.SelectedValue = dt.Rows(0)(2).ToString

            dgDatos.DataSource = SolicitudCompraProductoBL.ListarxCodigo(intNumCompra)
            dgDatos.DataBind()
        End If
    End Sub

    Protected Sub btnCancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Response.Redirect("ListaSolicitudCompra.aspx")
    End Sub

    Private Sub ListarSolicitante()
        ddlSolicitante.DataSource = SolicitanteBL.ListarTodo()
        ddlSolicitante.DataTextField = "NombreCompleto"
        ddlSolicitante.DataValueField = "CodigoSolictante"
        ddlSolicitante.DataBind()
    End Sub
End Class
